{include 'admin/layout/header_list'}
<link rel="stylesheet" href="__ADMIN_STATIC__/css/addContent.css?random={extendSetting('random')}">
<link rel="stylesheet" href="__ADMIN_STATIC__/css/content.css?random={extendSetting('random')}">
<div>
    <table id="updateList">
        <tr>
            <th width="60"></th>
            <th width="160">版本</th>
            <th width="130">类型</th>
            <th width="130">更新时间</th>
            <th width="100">大小</th>
            <th width="60">更新</th>
            <th width="60">下载</th>
            <th width="60">说明</th>
            <th width="60">标题</th>
            <th></th>
        </tr>

    </table>

</div>

<script src="__ADMIN_STATIC__/js/addContent.js?random={extendSetting('random')}"></script>
<script src="__ADMIN_STATIC__/js/list.js?random={extendSetting('random')}"></script>
<script>

    let updateList ={$updateList}  //玄学注释
    let $version ="{LT_VERSION}"



    function getVersionList() {
        for (let i = 0; i < updateList.length; i++) {
            let iteam = updateList[i];

            // 获取表格对象
            var table = $("#updateList");
            // 创建新的行
            var newRow = $("<tr class='on' align='center'></tr>");
            // 将单元格添加到新行中
            if (iteam.version==$version){
                newRow.append($("<td>当前版本</td>"));
            }else {
                newRow.append($("<td></td>"));
            }

            newRow.append($("<td>" + iteam.version + "</td>"));

            newRow.append($("<td><span class='type"+iteam.type+"'>" + iteam.typeFormat + "</span></td>"));
            newRow.append($("<td>" + iteam.timeFormat + "</td>"));
            size = iteam.type === 4 ? iteam.completeSizeFormat : iteam.updateSizeFormat
            newRow.append($("<td>" + size + "</td>"));
            if (iteam.version==$version){
                newRow.append($("<td><a href='{LTCMS_ROUTE_PREFIX}/systemUpdate/backups?id="+iteam.id+"'  >还原</a></td>"));
            }  else if (updateList[i+1] && updateList[i+1].version==$version) {
                newRow.append($("<td><a href='{LTCMS_ROUTE_PREFIX}/systemUpdate/backups?id="+iteam.id+"' >更新</a></td>"));
            }else {
                newRow.append($("<td>--</td>"));
            }
            url = iteam.type === 4 ? iteam.completeUrl : iteam.updateUrl
            newRow.append($("<td><a href='" + url + "' target='_blank'>下载</a></td>"));
            newRow.append($("<td><a href='" + iteam.contentUrl + "' target='_blank'>查看</a></td>"));
            newRow.append($("<td>"+iteam.title+"</td>"));

            // 将新行添加到表格中
            table.append(newRow);
        }
    }
    getVersionList()
/*    let msgIndex = layer.msg('加载中', {
        icon: 16,
        shade: 0.05,
        time:60000
    });*/
/*    updateList=jQuery.getJSON('{$cmsSystemUrl}/api/cmsUpdateLog/getVersionList?env=4',
        function (json) {
            layer.close(msgIndex)
            updateList= json.data
            getVersionList()
        });*/
</script>
<style>


    .type2 {
        color: green;
    }

    .type3 {
        color: #FF6600
    }

    .type4 {
        color: blue
    }

    @keyframes spin {
        0% {
            transform: rotate(0deg);
        }
        100% {
            transform: rotate(360deg);
        }
    }


</style>

{include 'admin/layout/footer'}